package com.wan.rabbitmq.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


/**
 * @author 万明宇 on 2018/3/7.
 */

@Configuration
public class TopicTestConfig {

    @Bean
    public Queue myTopic01(){
        return new Queue("myTopic01");
    }

    @Bean
    public Queue myTopic02(){
        return new Queue("myTopic02");
    }

    @Bean
    public TopicExchange topicExchange(){
        return new TopicExchange("wanmingyu");
    }

    @Bean
    public Binding bindingTopicExchange1(Queue myTopic01, TopicExchange topicExchange){
        return BindingBuilder.bind(myTopic01).to(topicExchange).with("topic.wan");
    }

    @Bean
    public Binding bindingTopicExchange2(Queue myTopic02, TopicExchange topicExchange){
        return BindingBuilder.bind(myTopic02).to(topicExchange).with("topic.#");
    }
}
